import os
import csv
# dict1={}
# dict2={}
# with open('D:\\Work\\Tool\\tiktok\\all\\infos.tsv', 'r', encoding='utf-8',
#           newline='\n') as filename_input:
#     reader = csv.reader(filename_input, delimiter='\t')
#     next(reader)
#     with open('D:\\Work\\Tool\\tiktok\\all\\ab.tsv', 'r', encoding='utf-8', newline='\n') as filename_input1:
#         reader1 = csv.reader(filename_input1, delimiter='\t')
#         next(reader1)
#         for line in reader:
#             if line[0] in dict1.keys():
#                 dict1[line[0]].append(line[1])
#             else:
#                 dict1[line[0]]=[line[1]]
#         for line in reader1:
#             if line[0] in dict2.keys():
#                 dict2[line[0]].append(line[1])
#             else:
#                 dict2[line[0]] = [line[1]]
#         for i in dict1.keys():
#             if len(dict1[i])!=len(dict2[i]):
#                 print(i,len(dict1[i]),len(dict2[i]))
#                 if int(i) <5 :
#                     print(list(set(dict2[i])-set(dict1[i])))
import json
idlist=['6886852740622929154', '6886463301140696326']
ht='ComingOfAge'
for name in os.listdir('D:\\Work\\Tool\\tiktok\\TikToks\\'):
    if ht in name :
        with open('D:\\Work\\Tool\\tiktok\\TikToks\\' +name, 'r', encoding='utf-8',
                  newline='\n') as filename_input:
            f = []
            i=0
            for line in filename_input:
                z = json.loads(line)
                if 'id' in z.keys():
                    id = z['id']

                elif 'itemInfos' in z.keys():
                    id = z['itemInfos']['id']
                if id  in idlist:
                    print(name)
                    print(line)
                    print(i)
                i+=1

